/*
 * @Author: Olivia
 * @Date: 2022-06-14 23:45:13
 * @LastEditTime: 2022-12-05 21:39:43
 * @FilePath: \toutiao-m\src\api\article.js
 * @custom_string_Olivia: Less is more
 */
/* 用户请求相关模块 */
import request from '@/utils/request'
/* 频道新闻推荐
 */
export const getArticleList = (params) => {
  return request({
    method: 'get',
    url: '/app/v1_0/articles',
    params
  })
}
/* 频道新闻详情
 */
export const getArticleListById = articleId => {
  return request({
    method: 'get',
    url: `/app/v1_0/articles/${articleId}`
  })
}
/* 收藏文章
 */
export const addCollect = target => {
  return request({
    method: 'post',
    url: '/app/v1_0/article/collections',
    data: {
      target
    }
  })
}/* 取消收藏
 */
export const deleteCollect = target => {
  return request({
    method: 'delete',
    url: `/app/v1_0/article/collections/${target}`
  })
}
/* 点赞文章
 */
export const addLike = target => {
  return request({
    method: 'post',
    url: ' /app/v1_0/article/likings',
    data: {
      target
    }
  })
}
/* 取消点赞
 */
export const deleteLike = target => {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/article/likings/${target}`
  })
}
